For better performance you can have the C1PdfViewer control load documents in the background asynchronously. Using the .NET await keyword, you can easily call asynchronous methods. To open a file selected by the user asynchronously, complete the following code:
C# |
Copy Code
|
---|---|
FileOpenPicker openPicker = new FileOpenPicker(); openPicker.FileTypeFilter.Add(".pdf"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { Stream stream = await file.OpenStreamForReadAsync(); await pdfViewer.LoadDocumentAsync(stream); } |